<?php
my_component_load('testing' , false);
my_component_load('paging' , false);
my_component_load('komponen_gaji');
my_component_load('data_setting', false);
$task = isset($_GET['task']) ? $_GET['task'] : ""; 
$jid= isset( $_GET['jid'] ) ? $_GET['jid']:  0;
$id= isset( $_GET['id'] ) ? $_GET['id']:  0;
$modulname = "Admin _BN_ Konfigurasi Data";
switch ($jid)
{
	case 1:
		$pagename = "Tunjangan";
		break;
	case 2:
		$pagename = "Potongan";
		break;
	case 3:
		$pagename = "Iuran";
		break;
	default:
		$pagename = "Lain-lain";
}	
		
if($_SERVER['REQUEST_METHOD'] == "POST" ):
    $validatepost = form_komponen_gaji_validate($jid,$id);
	if($validatepost){
		$content = message_multi_error($validatepost);
		$content .= form_komponen_gaji_create($jid,$id);
		generate_my_web($content,"","plain.php");
		exit;
	}else{
		form_komponen_gaji_submit($jid,$id);
		$content =  "Updated";
		generate_my_web($content,"","plain.php");
		exit;
	}
	my_direct('index.php?com=komponen_gaji&jid='.$jid);
	break;
else: 
	if($task == 'page'){
		$view  = form_komponen_gaji_create($jid,$id);
		generate_my_web($view,"","plain.php");
		exit; 		
	}elseif($task =='edit'){
		$pagename= ($id > '0' ) ?  "Perubahan Data ".$pagename : "Tambah Data ".$pagename;
		facebox_page('index.php?com=komponen_gaji&task=page&jid='.$jid.'&id='.$id , $pagename , 490	); 			
	}elseif($task =='delete'){
		 delete_komponen_gaji($id);
		 my_direct($_SERVER['HTTP_REFERER']);
	}else{
		load_facebox_script();	
		$view = list_komponen_gaji($jid);
		$href = 'index.php?com=komponen_gaji&task=edit&jid='.$jid.'&id=0' ;	
	}
endif;  
$content = spliter_browser( $view , $pagename ,$href);
generate_my_web($content, $modulname." _BN_ ".$pagename );
?> 
